home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -screenplay- / shareware / warpquake / warpquakesrc / sys_dosa.s < prev    next >
Text File  |  2000-02-29  |  1KB  |  96 lines

  1. //
  2. // sys_dosa.s
  3. // x86 assembly-language DOS-dependent routines.
  4.  
  5. #include "asm_i386.h"
  6. #include "quakeasm.h"
  7.  
  8.  
  9.     .data
  10.  
  11.     .align    4
  12. fpenv:
  13.     .long    0, 0, 0, 0, 0, 0, 0, 0
  14.  
  15.     .text
  16.  
  17. .globl C(MaskExceptions)
  18. C(MaskExceptions):
  19.     fnstenv    fpenv
  20.     orl        $0x3F,fpenv
  21.     fldenv    fpenv
  22.  
  23.     ret
  24.  
  25. #if 0
  26. .globl C(unmaskexceptions)
  27. C(unmaskexceptions):
  28.     fnstenv    fpenv
  29.     andl        $0xFFFFFFE0,fpenv
  30.     fldenv    fpenv
  31.  
  32.     ret
  33. #endif
  34.  
  35.     .data
  36.  
  37.     .align    4
  38. .globl    ceil_cw, single_cw, full_cw, cw, pushed_cw
  39. ceil_cw:    .long    0
  40. single_cw:    .long    0
  41. full_cw:    .long    0
  42. cw:            .long    0
  43. pushed_cw:    .long    0
  44.  
  45.     .text
  46.  
  47. .globl C(Sys_LowFPPrecision)
  48. C(Sys_LowFPPrecision):
  49.     fldcw    single_cw
  50.  
  51.     ret
  52.  
  53. .globl C(Sys_HighFPPrecision)
  54. C(Sys_HighFPPrecision):
  55.     fldcw    full_cw
  56.  
  57.     ret
  58.  
  59. .globl C(Sys_PushFPCW_SetHigh)
  60. C(Sys_PushFPCW_SetHigh):
  61.     fnstcw    pushed_cw
  62.     fldcw    full_cw
  63.  
  64.     ret
  65.  
  66. .globl C(Sys_PopFPCW)
  67. C(Sys_PopFPCW):
  68.     fldcw    pushed_cw
  69.  
  70.     ret
  71.  
  72. .globl C(Sys_SetFPCW)
  73. C(Sys_SetFPCW):
  74.     fnstcw    cw
  75.     movl    cw,%eax
  76. #if    id386
  77.     andb    $0xF0,%ah
  78.     orb        $0x03,%ah    // round mode, 64-bit precision
  79. #endif
  80.     movl    %eax,full_cw
  81.  
  82. #if    id386
  83.     andb    $0xF0,%ah
  84.     orb        $0x0C,%ah    // chop mode, single precision
  85. #endif
  86.     movl    %eax,single_cw
  87.  
  88. #if    id386
  89.     andb    $0xF0,%ah
  90.     orb        $0x08,%ah    // ceil mode, single precision
  91. #endif
  92.     movl    %eax,ceil_cw
  93.  
  94.     ret
  95.  
  96.